<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<!-- 学生系统查看成绩 -->
		<link rel="stylesheet" type="text/css" href="../js/layui/css/layui.css" />
		<style type="text/css">
			#test4 {
				margin-top: 5px;
				margin-left: 20px;
			}

			.layui-table-view {
				margin-top: 10px;
			}

			.layui-btn-container {
				height: 47px;
			}
		</style>
	</head>
	<body>
		<form class="layui-form" action="" id="formone">
			<div class="layui-inline">
				<label class="layui-form-label">作业标题</label>
				<div class="layui-input-block">
					<input type="text" name="tname" id="tname" lay-verify="title" autocomplete="off"
						placeholder="请输入作业标题" class="layui-input">
				</div>
			</div>
			<div class="layui-inline">
				<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
			</div>
		</form>
		<table class="layui-hide" id="studentList" lay-filter="studentList"></table>
		<div id="studentTaskdiv" style="display: none;">
			<table class="layui-hide" id="studentScore" lay-filter="studentScore">
				<div class="layui-btn-container">
					<button type="button" class="layui-btn layui-btn-primary" id="test4"><i
							class="layui-icon"></i>只允许DOCX文件</button>
				</div>
			</table>
		</div>
	</body>
	<script type="text/html" id="barDemo">
		<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">作业详情</a>
	</script>
	<script src="../js/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<script src="../task/studenttask.js" type="text/javascript" charset="utf-8"></script>
	<script src="../task/studenttaskstudent.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		function TaskStudentHref(taskStudentHrefId) {
			layui.use(['upload', 'element', 'layer'], function() {
				var $ = layui.jquery,
					upload = layui.upload,
					element = layui.element,
					layer = layui.layer;
				upload.render({ //允许上传的文件后缀
					elem: '#test4',
					url: 'http://localhost:8080/springend-sys/upload', //此处配置你自己的上传接口即可
					accept: 'file', //普通文件
					exts: 'docx', //只允许上传压缩文件
					dataType: "json",
					done: function(res) {
						updateTaskStudentHref(res.data,taskStudentHrefId);
					}
				});
			})
		}
		function updateTaskStudentHref(href,id){
			// console.log(href);
			// console.log(id);
			$.ajax({
				url:'http://localhost:8080/springend-sys/updateTaskStudentHref',
				type:"post",
				data:{
					href:href,
					id:id
				},
				dataType:"json",
				success:function(result){
					// console.log(result);
					if(result.status == 0){
						layer.msg("提交成功");
						location.reload();//刷新页面
					}else{
						layer.msg("提交失败");
					}
					// if (res != null && res != '') {
					// 	return layer.msg('上传成功');
					// } else {
					// 	return layer.msg('上传成功');
					// }
				}
			})
		}
	</script>
</html>
